/************************************************************************
  * Copyright(c) 2023 Levetop Semiconductor Co.,Led. All rights reserved.
  * @file     pit.h
  * @author   UartTFT Application Team
  * @version  V0.0.1
  * @date     2023-01-01
  * @brief    
 *************************************************************************/

#ifndef _PIT_H
#define _PIT_H

#include "data.h"

typedef struct
{
  uint8_t CMD;   // Modbus read and write instructions
  uint16_t Addr; // Modbus slave register address
  uint16_t Num;  // Read and write data length(2Bytes)
} MB_CMD_RXINFO;
extern volatile MB_CMD_RXINFO gMB_CMDRX;
extern volatile uint8_t Feedback_ModbusBuf[];
extern uint8_t flag_MB_REG[];

//CJC
extern volatile uint8_t Addr_ModBus_Sla;

extern volatile uint32_t pit_1ms_count;
extern volatile uint8_t uart_flag;

extern volatile uint32_t pit_1ms_count3;
extern volatile uint8_t timeout_flag;

extern volatile uint32_t tx_10ms_cnt;
extern volatile uint8_t tx_500ms_flag;

void PIT1_Init(void);
void PIT2_Init(uint16_t arr);

// extern void PIT0_Handler(void);
// extern void PIT1_Handler(void);
// extern void PIT2_Handler(void);
// extern void PIT3_Handler(void);
extern void LT_UsartTimeEnable(void);
extern void LT_UsartTimeDisable(void);
extern void LT_UsartTimeSetCounter(uint32_t Counter);

extern uint8_t twinkle_flag;
extern uint8_t twinkle_sum;
extern uint8_t twinkle_mode;
extern uint8_t delay_flag;
//extern uint8_t delay_sum;
extern uint8_t pageSTART_flag;
#endif /* _PIT_H */
